package com.memory;

import java.nio.ByteBuffer;
import java.util.Scanner;

/**
 * @author: csh
 * @Date: 2021/5/8 18:49
 * @Description:非直接缓存冲
 */
public class ByteBufferTest {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocateDirect(1024*1024*1024);
        System.out.println("开始分配内存");

        Scanner scanner = new Scanner(System.in);
        scanner.next();

        System.out.println("直接内存开始释放");
        byteBuffer=null;
        System.gc();
        scanner.next();
    }
}
